<?php

namespace App\Policies;

use App\Http\Controllers\Admin\Member\Repository\Member;
use App\Scenic;

use App\ScenicBuy;
use App\Setting;
use Illuminate\Auth\Access\HandlesAuthorization;

class ScenicPolicy
{
    use HandlesAuthorization;

    /**
     * Create a new policy instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }
    public function buy(Member $user,Scenic $scenic){
        $scenicBuy= ScenicBuy::where('member_id',$user->id)->where('scenic',$scenic->id)->first();
        if($scenicBuy||Setting::getConfig('sceneId')==$scenic->id){
            return true;
        }
        return false;
    }
}
